package com.itheima.spec.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.goods.pojo.Spec;
import com.itheima.spec.mapper.SpecMapper;
import com.itheima.spec.service.SpecService;
import entity.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpecServiceImpl extends ServiceImpl<SpecMapper,Spec> implements SpecService  {

    @Autowired
    private SpecMapper specMapper;

    @Override
    public PageResult findSpecByPage(Integer currentPage, Integer pagesize) {
        Page<Spec> page = new Page<>(currentPage, pagesize);
        specMapper.selectPage(page,null);
        PageResult<Spec> pageResult = new PageResult<>();
        List<Spec> records = page.getRecords();//当前页数据
        pageResult.setTotal(page.getTotal());//总记录数
        pageResult.setRows(records);
        return pageResult;
    }

    @Override
    public void insertSpec(Spec spec) {

    }

    @Override
    public void deleteSpec(Integer id) {

    }

    @Override
    public List<Spec> findSpecById(Integer id) {
        return null;
    }

    @Override
    public void updateSpec(String name, String options, Integer seq, Integer id) {

    }

    @Override
    public List<Spec> findSpecLikeName(String name) {
        return null;
    }
}
